<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>公告详细</title>
    <link rel="stylesheet" href="/static/assets/css/layui.css" media="all">
    <link rel="stylesheet" href="/static/assets/css/checkbox.css" media="all">
</head>
<body>
<div class="layui-container">
    <div class="layui-row">
        <div class="layui-col-md4 layui-col-lg-offset4">
            <h2>
                <span class="layui-bg-red" style="margin-left: 0">
                    标题：
                </span>
                <span id="title" style="margin-left: 50px">

                </span>
            </h2>
            <h3>
                <span>
                    发布日期：
                </span>
                <span id="releaseTime">

                </span>
            </h3>
        </div>
    </div>
    <div class="layui-row layui-col-space12">
        <div class="layui-col-md6" style="background-color: #eeeeee">
            <div class="layui-card">
                <div class="layui-card-header">内容</div>
                <div class="layui-card-body" style="width: 535px; height: 300px;" id="content">

                </div>
            </div>
        </div>
        <div class="layui-col-md6" style="background-color: #eeeeee">
            <div class="layui-card">
                <div class="layui-card-header">卡片面板</div>
                <div class="layui-card-body">
                    <img id="imgs" style="width: 535px; height: 300px;"/>
                </div>
            </div>
        </div>
    </div>
</div>
</body>
</html>
<script src="/static/assets/layui.js" charset="utf-8"></script>
<script src="/static/assets/jquery.min.js"></script>
<script>
    $(function () {
        layui.use(['element','layer'], function () {
            var layer = layui.layer,
                element = layui.element;

            //通过名称得到url传参的值
            function getQueryString(name) {
                var reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)', 'i');
                var r = window.location.search.substr(1).match(reg);
                if (r != null) {
                    return unescape(r[2]);
                }
                return null;
            }

            var announcementsId = getQueryString('announcementsId')

            $.ajax({
                url: '/announcement/showOne',
                type: 'post',
                dataType: 'json',
                headers: {'Content-Type': 'application/json;charset=utf8'},
                data: JSON.stringify({
                    announcementsId: announcementsId
                }),
                success: function (res) {
                    var Announcement = res.data.Announcement;
                    // $("#announcementsId").val(Announcement.announcementsId)
                    $("#title").append(Announcement.title)
                    $("#content").append(Announcement.content)
                    $("#releaseTime").append(Announcement.releaseTime)
                    $("#imgs").attr("src", Announcement.imgs)
                    layer.msg("拉取信息成功")
                    console.log(res)
                },
                error: function (res) {
                    layer.msg("拉取信息失败")
                }
            })
        })
    })
</script>